﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AVIS.OutBound.WizardAgent
{
    /// <summary>
    /// Wizard接口的配置信息
    /// </summary>
    public sealed class WizardConsts
    {
        public static string OutboundUrl = System.Configuration.ConfigurationManager.AppSettings["OutboundUrl"];
        public static string OutboundUser = System.Configuration.ConfigurationManager.AppSettings["OutboundUser"];
        public static string OutboundPwd = System.Configuration.ConfigurationManager.AppSettings["OutboundPwd"];
        public static string OutboundRequestID = System.Configuration.ConfigurationManager.AppSettings["OutboundRequestID"];

        /// <summary>
        /// Wizard接口返回XML的命名空间
        /// </summary>
        public const string XNamespace = "http://www.opentravel.org/OTA/2003/05";

        #region 获取车组信息的请求XML（OTA_VehAvailRateRQ——Vehicle Availability and Rate Request）
        /// <summary>
        /// 获取车组信息的请求XML（OTA_VehAvailRateRQ——Vehicle Availability and Rate Request）
        /// </summary>
        public const string OTA_VehAvailRateRQ = @"
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://www.w3.org/2001/12/soap-envelope' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
    <SOAP-ENV:Header>
        <ns:credentials xmlns:ns='http://wsg.avis.com/wsbang/authInAny'>
            <ns:userID ns:encodingType='xsd:string'>OutboundUser</ns:userID>
            <ns:password ns:encodingType='xsd:string'>OutboundPwd</ns:password>
        </ns:credentials>
        <ns:WSBang-Roadmap xmlns:ns='http://wsg.avis.com/wsbang'/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns:Request xmlns:ns='http://wsg.avis.com/wsbang'>
            <OTA_VehAvailRateRQ EchoToken='XXX1234' Target='Production' Version='1.0' SequenceNmbr='1' MaxResponses='50'  ReqRespVersion='medium' xmlns='http://www.opentravel.org/OTA/2008/05' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.opentravel.org/OTA/2008/05 OTA_VehAvailRateRQ.xsd'>
                <POS>
                    <Source>
                        <RequestorID Type='1' ID='OutboundRequestID'/>
                    </Source>
                   {7}
                </POS>
                <VehAvailRQCore Status='Available'>
                    <VehRentalCore  PickUpDateTime='{0:s}' ReturnDateTime='{1:s}'>
                        <PickUpLocation LocationCode='{2}'/>
                        <ReturnLocation LocationCode='{3}'/>
                    </VehRentalCore>
                    <VendorPrefs>
                        <VendorPref CompanyShortName='Avis'/>
                    </VendorPrefs>
                    <VehPrefs>
                        <VehPref TransmissionType='Manual' TransmissionPref='Preferred' TypePref='Preferred' ClassPref='Preferred' AirConditionPref='Preferred'>
                            <VehType VehicleCategory='1'/>
                            <VehClass Size='3'/>
                        </VehPref>
                    </VehPrefs>
                    {6}
                </VehAvailRQCore>
                <VehAvailRQInfo>
                    <Customer>
                        <Primary>
                           {4}
                            <CitizenCountryName Code='CN' />
                           {5}
                        </Primary>
                    </Customer>
                </VehAvailRQInfo>
            </OTA_VehAvailRateRQ>
        </ns:Request>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
";
        #endregion

        #region 获取单个车组信息的请求XML（OTA_VehAvailRateRQ——Vehicle Availability and Rate Request）
        /// <summary>
        /// 获取单个车组信息的请求XML（OTA_VehAvailRateRQ——Vehicle Availability and Rate Request）
        /// </summary>
        public const string OTA_VehAvailRateRQ_One = @"
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://www.w3.org/2001/12/soap-envelope' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
    <SOAP-ENV:Header>
        <ns:credentials xmlns:ns='http://wsg.avis.com/wsbang/authInAny'>
            <ns:userID ns:encodingType='xsd:string'>OutboundUser</ns:userID>
            <ns:password ns:encodingType='xsd:string'>OutboundPwd</ns:password>
        </ns:credentials>
        <ns:WSBang-Roadmap xmlns:ns='http://wsg.avis.com/wsbang'/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns:Request xmlns:ns='http://wsg.avis.com/wsbang'>
            <OTA_VehAvailRateRQ EchoToken='XXX1234' Target='Production' Version='1.0' SequenceNmbr='1' MaxResponses='1'  ReqRespVersion='medium' xmlns='http://www.opentravel.org/OTA/2008/05' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.opentravel.org/OTA/2008/05 OTA_VehAvailRateRQ.xsd'>
                <POS>
                    <Source>
                        <RequestorID Type='1' ID='OutboundRequestID'/>
                    </Source>
                   {7}
                </POS>
                <VehAvailRQCore Status='Available'>
                    <VehRentalCore  PickUpDateTime='{0:s}' ReturnDateTime='{1:s}'>
                        <PickUpLocation LocationCode='{2}'/>
                        <ReturnLocation LocationCode='{3}'/>
                    </VehRentalCore>
                    <VendorPrefs>
                        <VendorPref CompanyShortName='Avis'/>
                    </VendorPrefs>
                    <VehPrefs>
                        <VehPref TransmissionType='Manual' TransmissionPref='Only' TypePref='Only' ClassPref='Only' AirConditionPref='Preferred' >
                            <VehType VehicleCategory='1'/>
                            <VehClass Size='3'/>
                            <VehGroup GroupType='SIPP' GroupValue='{8}'/>
                        </VehPref>
                    </VehPrefs>
                    {6}
                </VehAvailRQCore>
                <VehAvailRQInfo>
                    <Customer>
                        <Primary>
                           {4}
                            <CitizenCountryName Code='CN' />
                           {5}
                        </Primary>
                    </Customer>
                </VehAvailRQInfo>
            </OTA_VehAvailRateRQ>
        </ns:Request>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
";
        #endregion

        #region PayLaterBaseInfoXML
        public const string PayLaterBaseInfoXML = @"
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://www.w3.org/2001/12/soap-envelope' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
    <SOAP-ENV:Header>
        <ns:credentials xmlns:ns='http://wsg.avis.com/wsbang/authInAny'>
            <ns:userID ns:encodingType='xsd:string'>OutboundUser</ns:userID>
            <ns:password ns:encodingType='xsd:string'>OutboundPwd</ns:password>
        </ns:credentials>
        <ns:WSBang-Roadmap xmlns:ns='http://wsg.avis.com/wsbang'/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns:Request xmlns:ns='http://wsg.avis.com/wsbang'>
            <OTA_VehAvailRateRQ EchoToken='XXX1234' Target='Production' Version='1.0' SequenceNmbr='1' MaxResponses='50'  ReqRespVersion='medium' xmlns='http://www.opentravel.org/OTA/2008/05' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.opentravel.org/OTA/2008/05 OTA_VehAvailRateRQ.xsd'>
                <POS>
                    <Source>
                        <RequestorID Type='1' ID='OutboundRequestID'/>
                    </Source>
                    <!-- 如果有协议号，填写协议编号和Type=5, 否则删除<Source>节点 -->
                   {7}
                </POS>
                <VehAvailRQCore Status='Available'>
                    <VehRentalCore  PickUpDateTime='{0:s}' ReturnDateTime='{1:s}'>
                        <PickUpLocation LocationCode='{2}'/>
                        <ReturnLocation LocationCode='{3}'/>
                    </VehRentalCore>
                    <VendorPrefs>
                        <VendorPref CompanyShortName='Avis'/>
                    </VendorPrefs>
                    <VehPrefs>
                        <VehPref TransmissionType='Manual' TransmissionPref='Preferred' TypePref='Preferred' ClassPref='Preferred' AirConditionPref='Preferred'>
                            <VehType VehicleCategory='1'/>
                            <VehClass Size='3'/>
                        </VehPref>
                    </VehPrefs>
                    <!--
                              1、使用RateQualifier【RateCode】 获取套餐数据，RateCategory = 2；
                                 如果没有RateCode, RateCategory = 6；
                              2、如果有CouponNum，PromotionCode='CouponNum'；
                              3、如果有AWD， CorpDiscountNmbr='AWD';
                              4、如果没有RateCode，CouponNum，AWD，则不需要这个节点
                    -->
                    {6}
                </VehAvailRQCore>
                <VehAvailRQInfo>
                    <Customer>
                        <Primary>
                            <!-- 如果有姓的添加PersonName节点 -->
                           {4}
                            <CitizenCountryName Code='CN' />
                            <!-- 如果有会员号，则添加这个节点 -->
                           {5}
                        </Primary>
                    </Customer>
                </VehAvailRQInfo>
            </OTA_VehAvailRateRQ>
        </ns:Request>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
";
        #endregion

        #region PayLaterBaseInfoXML
        /// <summary>
        /// 获取增值服务和租车须知 QN获取车组详情
        /// </summary>
        public const string OrderProductListXML = @"
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://www.w3.org/2001/12/soap-envelope' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
    <SOAP-ENV:Header>
        <ns:credentials xmlns:ns='http://wsg.avis.com/wsbang/authInAny'>
            <ns:userID ns:encodingType='xsd:string'>OutboundUser</ns:userID>
            <ns:password ns:encodingType='xsd:string'>OutboundPwd</ns:password>
        </ns:credentials>
        <ns:WSBang-Roadmap xmlns:ns='http://wsg.avis.com/wsbang'/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns:Request xmlns:ns='http://wsg.avis.com/wsbang'>
        <OTA_VehRateRuleRQ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' Version='1.0' CompanyShortName='Avis'>
            <POS>
                 <Source>
                     <RequestorID Type='1' ID='OutboundRequestID'/>
                 </Source>
                 {0}
            </POS>
            <RentalInfo>
                <VehRentalCore PickUpDateTime='{1:s}' ReturnDateTime='{2:s}'>
                    <PickUpLocation LocationCode='{3}' />
                    <ReturnLocation LocationCode='{4}' />
                </VehRentalCore>
                <VehicleInfo TransmissionType='Manual' TransmissionPref='Preferred' TypePref='Preferred' ClassPref='Preferred' AirConditionPref='Preferred'>
                    <VehType VehicleCategory='1'/>
                    <VehClass Size='3'/>
                    <VehGroup GroupType='SIPP' GroupValue='{5}'/>
                </VehicleInfo>
                {6} 
                <CustomerID Type='1' ID='CN'/> 
            </RentalInfo>
        </OTA_VehRateRuleRQ>
         </ns:Request>
            </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>";
        #endregion

        #region 提交订单

        /// <summary>
        /// QN新增订单
        /// </summary>
        public const string PayLaterAddOrderXML = @"
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
    <SOAP-ENV:Header>
        <ns:credentials xmlns:ns='http://wsg.avis.com/wsbang/authInAny'>
            <ns:userID ns:encodingType='xsd:string'>OutboundUser</ns:userID>
            <ns:password ns:encodingType='xsd:string'>OutboundPwd</ns:password>
        </ns:credentials>
        <ns:WSBang-Roadmap xmlns:ns='http://wsg.avis.com/wsbang'/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns:Request xmlns:ns='http://wsg.avis.com/wsbang'>
            <OTA_Veh{11}RQ ReqRespVersion='1.0' SequenceNmbr='2' Target='Test' Version='1.0' xsi:schemaLocation='http://www.opentravel.org/OTA/2008/05 OTA_VehResRQ.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.opentravel.org/OTA/2003/05'>
                <POS xmlns='http://www.opentravel.org/OTA/2008/05'>
                    <Source>
                        <RequestorID ID='OutboundRequestID' Type='1'/>
                   </Source> 
                      {20}
                </POS>
                <Veh{11}RQCore {9}>
                        {10}
                    <VehRentalCore PickUpDateTime='{0:s}' ReturnDateTime='{1:s}'>
                        <PickUpLocation CodeContext='IATA' LocationCode='{2}'/>
                        <ReturnLocation CodeContext='IATA' LocationCode='{3}'/>
                    </VehRentalCore>
                    <Customer>
                        <Primary>
                            <PersonName>
                                <GivenName>{4}</GivenName>
                                <Surname>{5}</Surname>
                            </PersonName>
                           {12}
                           {13}
                           {14}
                           
                            {6}
                            <CitizenCountryName Code='CN'/>
                        </Primary>
                    </Customer>
                    {15}
                    <VehPref ClassPref='Only' TransmissionPref='Only' TransmissionType='Manual' TypePref='Only' AirConditionPref='Only'>
                        <VehType DoorCount='4' VehicleCategory='1'/>
                        <VehClass Size='6'/>
                        <VehGroup GroupType='SIPP' GroupValue='{7}'/>
                    </VehPref>
                   {8}
                </Veh{11}RQCore>
                <Veh{11}RQInfo> 
                    <ArrivalDetails {16} TransportationCode='{17}' >
                    {18}
                    </ArrivalDetails>
                    {19}
                </Veh{11}RQInfo>
            </OTA_Veh{11}RQ>
        </ns:Request>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
";
        #endregion

        #region 取消订单
        public const string OrderCancelXML = @"
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://www.w3.org/2001/12/soap-envelope' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
<SOAP-ENV:Header>
   <ns:credentials xmlns:ns='http://wsg.avis.com/wsbang/authInAny'>
      <ns:userID ns:encodingType='xsd:string'>OutboundUser</ns:userID>
      <ns:password ns:encodingType='xsd:string'>OutboundPwd</ns:password>
   </ns:credentials>
   <ns:WSBang-Roadmap xmlns:ns='http://wsg.avis.com/wsbang'/>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns:Request xmlns:ns='http://wsg.avis.com/wsbang'>
<OTA_VehCancelRQ xmlns='http://www.opentravel.org/OTA/2003/05' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.opentravel.org/OTA/2003/05 OTA_VehCancelRQ.xsd' Version='1.0' EchoToken='JSP12345'>
   <POS>
      <Source>
         <RequestorID Type='1' ID='OutboundRequestID'/>
      </Source>
   
   </POS>
   <VehCancelRQCore CancelType='Commit'>
      <UniqueID Type='15' ID='{0}'/> <!-- reservation number -->
         <PersonName>
            <Surname>{1}</Surname>
         </PersonName>
     </VehCancelRQCore>
    </OTA_VehCancelRQ>
    </ns:Request>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
";
        #endregion

        #region 查询订单
        public const string OrderQueryXML = @"
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://www.w3.org/2001/12/soap-envelope' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
    <SOAP-ENV:Header>
        <ns:credentials xmlns:ns='http://wsg.avis.com/wsbang/authInAny'>
            <ns:userID ns:encodingType='xsd:string'>OutboundUser</ns:userID>
            <ns:password ns:encodingType='xsd:string'>OutboundPwd</ns:password>
        </ns:credentials>
        <ns:WSBang-Roadmap xmlns:ns='http://wsg.avis.com/wsbang'/>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns:Request xmlns:ns='http://wsg.avis.com/wsbang'>
            <OTA_VehRetResRQ xmlns:xsi='http://www.w3.org/2008/XMLSchema-instance' Version='1.0'>
                <POS>
                    <Source>
                        <RequestorID Type='1' ID='OutboundRequestID'/>
                    </Source>
                    
                </POS>
                <VehRetResRQCore>
                    <UniqueID Type='14' ID='{0}'/>
                    <PersonName>
                        <Surname>{1}</Surname>
                    </PersonName>
                </VehRetResRQCore>
                <VehRetResRQInfo>
                    <Vendor CompanyShortName='Avis'/>
                </VehRetResRQInfo>
            </OTA_VehRetResRQ>
        </ns:Request>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
";
        #endregion

        /// <summary>
        /// Wizard预热请求(OTA_PingRQ——Ping Request)
        /// </summary>
        public const string PingRQXML = @"
            <OTA_PingRQ xmlns:xsi='http://www.w3.org/2008/XMLSchema-instance' Version='1.0'>
                    <EchoData>Hello World</EchoData>
            </OTA_PingRQ>";
    }
}
